#include <stdio.h>
#include <math.h>

int
is_palindrom (int n)
{
	int reverse=0, tmp;
	tmp = n;
	while (tmp > 0) {
		reverse = 10 * reverse + (tmp % 10);
		tmp /= 10;
	}
	//fprintf(stderr, "\tis_palindrom : n=%d, reverse=%d\n", n, reverse);
	if (reverse == n)
		return 1;
	else
		return 0;
}

int
i_sum_del (int n)
{
	register int j=1;
	int res=0;
	const double lim = sqrt(n);

	while (j <= lim) {
		if (n % j == 0) {
			res += j;
			res += n / j;
		}
		j++;
	}
	return j;
}

int
sum_del (int n)
{
	register int j;
	int res=0;
	for (j=1; j<=n; ++j) {
		if (n % j == 0)
			res += j;
	}
	return res;
}

int
sum_dig (int n)
{
	int sum=0, m=10;
	while (n > 0) {
		sum += n % m;
		n /= 10;
	}
	return sum;
}

int
main (int argc, char **argv)
{
	int a, b;
	register int i;

	scanf("%d %d", &a, &b);

	for (i=a; i<=b; ++i) {
		if ( (is_palindrom(i) == 1) && (sum_del(i) % sum_dig(i) == 0) ) {
			printf("%d ", i);
			//fprintf(stderr, "i=%hd, sum_del=%d, sum_dig=%d\n", i, sum_del(i), sum_dig(i));
		}
	}
	printf("\n");
	return 0;
}
